home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / upstart-compat-sysv.postrm < prev    next >
Text File  |  2008-09-29  |  2KB  |  97 lines

  1. #!/bin/sh -e
  2. # This script can be called in the following ways:
  3. #
  4. # After the package was removed:
  5. #    <postrm> remove
  6. #
  7. # After the package was purged:
  8. #    <postrm> purge
  9. #
  10. # After the package was upgraded:
  11. #    <old-postrm> upgrade <new-version>
  12. # if that fails:
  13. #    <new-postrm> failed-upgrade <old-version>
  14. #
  15. #
  16. # After all of the packages files have been replaced:
  17. #    <postrm> disappear <overwriting-package> <version>
  18. #
  19. #
  20. # If preinst fails during install:
  21. #    <new-postrm> abort-install
  22. #
  23. # If preinst fails during upgrade of removed package:
  24. #    <new-postrm> abort-install <old-version>
  25. #
  26. # If preinst fails during upgrade:
  27. #    <new-postrm> abort-upgrade <old-version>
  28.  
  29.  
  30. # Undo removal of a no-longer used conffile
  31. undo_rm_conffile()
  32. {
  33.     CONFFILE="$1"
  34.  
  35.     if [ ! -e "$CONFFILE" ]; then
  36.     if [ -e "$CONFFILE".dpkg-bak ]; then
  37.         echo "Restoring modified conffile $CONFFILE"
  38.         mv -f "$CONFFILE".dpkg-bak "$CONFFILE"
  39.     elif [ -e "$CONFFILE".dpkg-obsolete ]; then
  40.         mv -f "$CONFFILE".dpkg-obsolete "$CONFFILE"
  41.     fi
  42.     fi
  43. }
  44.  
  45. # Finish removal of a no-longer used conffile
  46. finish_rm_conffile()
  47. {
  48.     CONFFILE="$1"
  49.  
  50.     if [ -e "$CONFFILE".dpkg-bak ]; then
  51.     rm -f "$CONFFILE".dpkg-bak
  52.     fi
  53. }
  54.  
  55.  
  56. # Undo removal of obsolete jobs
  57. undo_rm_obsolete_jobs()
  58. {
  59.     undo_rm_conffile /etc/event.d/rc0-halt
  60.     undo_rm_conffile /etc/event.d/rc0-poweroff
  61. }
  62.  
  63. # Finish removal of obsolete jobs
  64. finish_rm_obsolete_jobs()
  65. {
  66.     finish_rm_conffile /etc/event.d/rc0-halt
  67.     finish_rm_conffile /etc/event.d/rc0-poweroff
  68. }
  69.  
  70.  
  71. case "$1" in
  72.     remove)
  73.     ;;
  74.  
  75.     purge)
  76.     finish_rm_obsolete_jobs
  77.     ;;
  78.  
  79.     upgrade|failed-upgrade|disappear)
  80.     ;;
  81.  
  82.     abort-install|abort-upgrade)
  83.     # Abort upgrade from edgy
  84.     if dpkg --compare-versions "$2" lt "0.3.5-1"; then
  85.         undo_rm_obsolete_jobs
  86.     fi
  87.     ;;
  88.  
  89.     *)
  90.     echo "$0 called with unknown argument \`$1'" 1>&2
  91.     exit 1
  92.     ;;
  93. esac
  94.  
  95.  
  96. exit 0
  97.